import express from 'express';
import { graphqlHTTP } from 'express-graphql';
import logger from './utils/logger';

const app = express();
const PORT = process.env.PORT || 3000;

app.use(
  '/graphql',
  graphqlHTTP(() => {
    return {
      schema: require('./graphql/schema'),
      graphiql: true
    };
  })
);

app.listen(PORT, () => {
  logger.info(`服务开启成功：http://127.0.0.1:${PORT}`);
});
